<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Quick installation guide</title>
</head>
<body style="font-family:sans-serif">

<p><a href="index.html">Overpass API</a> &gt;</p>

<h1>Quick installation guide</h1>

<p>We give here an installation guide for installing and starting the most common components. For other components, see the <a href="full_installation.html">detailed installation guide</a>. There is also <a href="https://wiki.openstreetmap.org/wiki/OSM3S/install">an installation guide on the wiki</a> which covers most errors that have ever been occured during installation and startup.</p>

<p>We do cover here various base systems, in particular at least Ubuntu Linux and FreeBSD.</p>


<h2>Outline</h2>

<p>We first give a complete list of commands you need for installation and startup:
The comands are explained afterwards:</p>

<p><a href="#required">Install required software packages (on Ubuntu)</a>:</p>
<pre>sudo apt-get install wget g++ make expat libexpat1-dev zlib1g-dev</pre>

<p><a href="#install">Install the Overpass API software</a>:</p>
<pre>wget https://dev.overpass-api.de/releases/osm-3s_v0.7.55.tar.gz
gunzip &lt;osm-3s_v0.7.55.tar.gz | tar xvf -
cd osm-3s_v0.7.55/
./configure
make
chmod 755 bin/*.sh cgi-bin/*</pre>

<p><a href="#clone">Clone the database</a> or <a href="#startup">import a planet file</a>:</p>
<pre>mkdir -p db</pre>
<pre>bin/download_clone.sh --source=https://dev.overpass-api.de/api_drolbr/ --db-dir=&quot;db/&quot; --meta=no</pre>
<p>or</p>
<pre>wget -O planet.osm.bz2 &quot;https://ftp.heanet.ie/mirrors/openstreetmap.org/planet/planet-latest.osm.bz2&quot;
bin/init_osm3s.sh planet.osm.bz2 &quot;db/&quot; &quot;./&quot; --meta</pre>

<p><a href="#minute_updates">Activate minutely updates</a>:</p>
<pre>mkdir -p diffs</pre>
<pre>nohup bin/dispatcher --osm-base --meta --db-dir=&quot;db/&quot; &amp;
chmod 666 &quot;db/osm3s_v0.7.55_osm_base&quot;
nohup bin/fetch_osc.sh <em>id</em> &quot;https://planet.openstreetmap.org/replication/minute/&quot; &quot;diffs/&quot; &amp;
nohup bin/apply_osc_to_db.sh &quot;diffs/&quot; auto --meta=yes &amp;</pre>


<h2><a name="required">Requirements</a></h2>

<p>With a POSIX conforming operating system (this includes all kinds of Linux as well as FreeBSD, OpenBSD and several others), you have already fulfilled most base requirements.</p>

<p>Concerning hardware, I suggest at least 4 GB of RAM. The more RAM is available, the better, because caching of disk content in the RAM will significantly speed up Overpass API. The processor speed will have little relevance. For the hard disk, it depends on what you want to install. A full planet database with minutely updates should have at least 250 GB of hard disk space at disposal. Without minute diffs and meta data, 100 GB would already suffice.</p>

<p>To automatically download diff files, you need a command line download tool. I suggest <em>wget</em>. If it is not already installed, you can get it on e.g. Ubuntu with:</p>
<pre>sudo apt-get install wget</pre>
<p>If you want to use another program instead of wget, you can find an explanation in <a href="full_installation.html">the detailed installation guide</a>.</p>

<p>To compile the software, you need a C++ compiler and <em>make</em>. I suggest <em>the GCC collection</em>. If it is not already installed, you can get it on e.g. Ubuntu with:</p>
<pre>sudo apt-get install g++ make</pre>

<p>To compile the software, you also need the <em>expat</em> library and the <em>zlib</em>. If it is not already installed, you can get it on e.g. Ubuntu with:</p>
<pre>sudo apt-get install expat libexpat1-dev zlib1g-dev</pre>
<p>You can also include expat from sources. Please have a look in <a href="full_installation.html">the detailed installation guide</a>.</p>


<h2><a name="install">Software Installation</a></h2>

<p>First, you need to download <a href="https://dev.overpass-api.de/releases/osm-3s_v0.7.55.tar.gz">the tarball of the latest version</a>:</p>
<pre>wget https://dev.overpass-api.de/releases/osm-3s_v0.7.55.tar.gz
gunzip &lt;osm-3s_v0.7.55.tar.gz | tar xvf -
cd osm-3s_v0.7.55/</pre>

<p>You need to choose a directory where you put the executable files. You can later move them to a different directory. But the default choice of the installation program <em>automake</em>, /usr/bin, requires root permissions, although no root permissions are really necessary to run the program. I suggest subdirectories of the source code directory: this can be reached with &quot;`pwd`&quot;. To configure this output directory and detect necessary adaptions of your system, run in the <em>build</em> subdirectory:</p>
<pre>../src/configure --prefix=&quot;`pwd`&quot;</pre>

<p>Generate the executables:</p>
<pre>make</pre>
<p>Another system than Linux may require here some extra parameters. For example, FreeBSD needs <em>-DNATIVE_LARGE_FILES</em>, because it doesn't have a separate <em>open64</em> function:</p>
<pre>make <strong>CPPFLAGS=&quot;-DNATIVE_LARGE_FILES&quot;</strong></pre>


<h2><a name="clone">Fast Startup</a></h2>

<p>Since version 0.6.98, the database can be cloned from an exisiting instance rather than created from scratch. This only takes 4 to 8 hours in comparison to 24 to 48 hours for an update from the planet file. Note that this feature is still rather experimental - please report any problems by eMail to me (roland at overpass-api.de). If you don't want the entire planet or prefer a manually planet import for some other reason, use the <a href="#startup">manual import</a> instead.</p>

<p>Download a clone of the database at <em>overpass-api.de</em> with the command:</p>
<pre>bin/download_clone.sh --source=https://dev.overpass-api.de/api_drolbr/ --db-dir=&quot;db/&quot; --meta=no</pre>
<p>or</p>
<pre><strong>nohup</strong> bin/download_clone.sh --source=https://dev.overpass-api.de/api_drolbr/ --db-dir=&quot;db/&quot; --meta=no <strong>&amp;</strong></pre>
<p>If you want meta data, use <em>--meta=yes</em> instead of <em>--meta=no</em>. This downloads about 30 GB (50 GB with meta data) in several compressed files and uncompresses them to a ready-to-use database.</p>

<p>Now you can proceed with <a href="#minute_updates">minute updates</a>.</p>


<h2><a name="startup">Startup</a></h2>

<p>The standard use case is to set up the database with the whole planet data and including meta data. If you haven't downloaded an <a href="https://wiki.openstreetmap.org/wiki/Planet.osm">OSM XML planet file</a> yet, you can fetch one for example with:</p>
<pre>wget -O planet.osm.bz2 &quot;https://ftp.heanet.ie/mirrors/openstreetmap.org/planet/planet-latest.osm.bz2&quot;</pre>
<p>This file has a size of more than 20 GB. Thus, depending on your internet connection, it may take between 4 hours (fastest possible) and 22 hours (with 2 MBit) to download the file. If you are not working on your local machine, you may want the download to continue even if you logout. Use <em>nohup</em> for this:</p>
<pre><strong>nohup</strong> wget -O planet.osm.bz2 &quot;https://ftp.heanet.ie/mirrors/openstreetmap.org/planet/planet-latest.osm.bz2&quot; <strong>&amp;</strong></pre>

<p>Once you have the file, you can start the import. The import again may take up to 48 hours:</p>
<pre>bin/init_osm3s.sh planet.osm.bz2 &quot;db/&quot; &quot;./&quot; --meta</pre>
<p>or</p>
<pre>nohup bin/init_osm3s.sh planet.osm.bz2 &quot;db/&quot; &quot;./&quot; --meta &amp;</pre>
<p>You may need to adapt the parameters: The first parameter <em>planet.osm.bz2</em> is the osm file to process, the second parameter <em>&quot;db/&quot;</em> is the directory where the database should go to, and the third parameter <em>&quot;./&quot;</em> is the base directory of the executables, i.e. there must exist <em>update_database</em> in the subdirectory <em>bin</em> of the location where the third parameter points to.</p>

<p>When this command is done, it writes <em>Update complete.</em> to the console (or to the file <em>nohup.out</em> if you have used <em>nohup</em>). At this point, the database can be used.</p>


<h2><a name="minute_updates">Minute Updates</a></h2>

<p>But maybe you also want minutely updates. In this case, run the commands:</p>
<pre>nohup bin/dispatcher --osm-base --meta --db-dir=&quot;db/&quot; &amp;</pre>
<pre>chmod 666 &quot;db/osm3s_v0.7.55_osm_base&quot;</pre>
<pre>nohup bin/fetch_osc.sh <em>id</em> &quot;https://planet.openstreetmap.org/replication/minute/&quot; &quot;diffs/&quot; &amp;</pre>
<pre>nohup bin/apply_osc_to_db.sh &quot;diffs/&quot; <em>id</em> --meta=yes &amp;</pre>
<p>These commands don't make sense without <em>nohup</em>, because the programs become daemons and never terminate.
Once again, you need to replace parameters: you always need to replace <em>id</em> by the replicate id to start from.
If you have cloned the database then the right id is the content of the file <em>db/replicate_id</em>.
Otherwise, search on <a href="https://planet.openstreetmap.org/replication/minute/">https://planet.openstreetmap.org/replication/minute/</a> with your browser for the last replication diff that has been created before the planet creation date.</p>

<p>The other parameters need only to be adapted if you have chosen a different directory in a previous step: <em>&quot;db/&quot;</em> is the directory of the database, <em>&quot;https://planet.openstreetmap.org/replication/minute/&quot;</em> is the replicate diff's remote source, and <em>&quot;diffs/&quot;</em> is the directory where the minute diffs are stored until they have been applied.</p>

<p>Congratulations! Now you have a database mirror that can serve the entire world and is always only a few minutes behind the OSM main database.</p>

</body>
</html>
